//
//  NSObject+Additions.m
//  MIYUE
//
//  Created by RanCheng on 15-1-12.
//  Copyright (c) 2015年 RanCheng. All rights reserved.
//

#import "NSObject+Additions.h"

@implementation NSObject (Additions)

-(BOOL)isNull
{
    if(self==nil || [self isKindOfClass:[NSNull class]])
    {
        return YES;
    }else{
        return NO;
    }
}

-(id)notNull
{
    if([self isNull])
    {
        if([self isKindOfClass:[NSString class]])
        {
            return @"";
        }
        else if([self isKindOfClass:[NSDictionary class]])
        {
            return [NSDictionary dictionary];
        }
        else if([self isKindOfClass:[NSArray class]])
        {
             return [NSArray array];
        }else if([self isKindOfClass:[NSMutableArray class]])
        {
             return [NSMutableArray arrayWithCapacity:1];
        }else if([self isKindOfClass:[NSMutableDictionary class]])
        {
            return [NSMutableDictionary dictionaryWithCapacity:1];
        }
    }else{
        return self;
    }
    
    return @"";
}

@end
